package edu.hnzj.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import edu.hnzj.entity.User;
import edu.hnzj.service.UserService;
import edu.hnzj.util.JsonResult;

@Controller
@RequestMapping("/user")
public class UserLoginController {
	
	@Resource
	private UserService userService;
	
	@RequestMapping("/login.do")
	@ResponseBody
	public JsonResult<User> execute(String username,String password){
		JsonResult<User> result = userService.checkLogin(username, password);
		return result;
	}
	
	
	@RequestMapping("/register.do")
	@ResponseBody
	public JsonResult<Object> executezhuce(String username,String password){
		JsonResult<Object> result = userService.addUser(username, password);
		return result;
	}
}
